package cn;

import java.util.Arrays;

public class 数组合并 {
    public static void main(String[] args) {
        merge();
    }
    public static void merge(){
        //定义两个数组
        int[] arr1={1,33,9,11,93,25,17,39};
        int[] arr2={12,44,69,8,10};
        int[] newArr=new int[arr1.length+arr2.length];
        int index=0;  //作为新数组的下标
        //遍历两个数组，把两个数组的值加到新数组中
        for (int i = 0; i <arr1.length ; i++) {
            newArr[index++]=arr1[i];
        }
        for (int i = 0; i <arr2.length ; i++) {
            newArr[index++]=arr2[i];
        }
        //排序
        Arrays.sort(newArr);
            System.out.println(Arrays.toString(newArr));
    }

}
